#ifndef __mysql_H__
#define __mysql_H__
#include <mysql/mysql.h>
#include <func.h>
#include <crypt.h>
#include <shadow.h>
#define SQL_MAX 1024
#define STR_LEN 8 //定义随机输出的字符串长度。
char *GenerateSalt(char *salt);
bool connectDB(MYSQL **mysql);
int addTableData(MYSQL *mysql, char *Tname, char *field, char *value);
char *searchTableData(MYSQL *mysql, char *Tname, char *column, char *where);
int delTabledata(MYSQL *mysql, char *Tname, char *where);
int altTabledata(MYSQL *mysql, char *Tname, char *newfield, char *where);
char *substring(char *ch, int pos, int length);
int findParentId(MYSQL *mysql, char *pwd);
int mkDir(MYSQL *mysql, int peerfd, int user_id, char *newdir);
int judge(MYSQL *mysql, char **pwd, int user_id, int *iu, int *cnt);
int ifLegality(MYSQL *mysql, char **pwd, int user_id);
int cd(MYSQL *mysql, int user_id, char *path);
char *Pwd(MYSQL *mysql, int peerfd, int user_id, char *pwd);
char *returnTableData(MYSQL *mysql, char *Tname, char *column, char *where);
int ls(MYSQL *mysql, int peerfd, int user_id, char *path);
char *encode(char *JWT, char *user_id);
bool decode(char *JWT);
#endif
